/**
 * data = {actionCode:9, pagedata:{phone:phone}}
 * callBack=function(responseData){}
 * 调用android本地方法
 */
function toast(tip){
	var data = {actionCode:14, data:{tip: tip}};
    window.WebViewJavascriptBridge.send(
        data,function(responseData) {
        }
    );
}
var msAndroid=function(){
	return {
		host:"",
		contextPath:'',
		path:"",
		pageData:{},
		init:function(host,contextPath,pageData){
			this.host=host==null?"":host;
			this.contextPath=contextPath==null?"":contextPath;
			this.path=this.host+this.contextPath;
			this.pageData=pageData==null?{}:pageData;
		},
		serializeObject:function(formPick){
			var o = {};  
		    var	a=$(formPick).serializeArray();
		    $.each(a, function() {
		       if (o[this.name]) {    
		           if (!o[this.name].push) {    
		               o[this.name] = [o[this.name]];    
		           }    
		           o[this.name].push(this.value || '');    
		       } else {    
		           o[this.name] = this.value || '';    
		       }    
		    });    
		    return o;  
		},
		//把form自动封装成changedTicketVO所需json格式
		changedTicketVO:function(formPick){
			var o = {};  
		    var	a=$(formPick).serializeArray();
		    $.each(a, function() {
		       if(this.name=='original'){
		    	   return true;
		       }
		       if(this.name=='ticketid'||this.name=='reason'||this.name=='action'){
		    	   o[this.name]=this.value;
		       }else{
		    	   if(!o.fields){
		    		   o.fields={};
		    	   }
		    	   if (o.fields[this.name]) {    
			           if (!o.fields[this.name].push) {    
			        	   o.fields[this.name] = [o.fields[this.name]];    
			           }    
			           o.fields[this.name].push(this.value || '');    
			       } else {
			    	   o.fields[this.name] = this.value || '';    
			       }    
		       }
		    });    
		    return o;  
		},
		attVO:function(formPick){
			var o = {};
		     var	a=$(formPick).serializeArray();
		   $.each(a, function() {
					   if(this.name=='original'){
						   return true;
					   }
					   if(this.name=='ticketid'||this.name=='reason'||this.name=='action'){
						   o[this.name]=this.value;
					   }
			 });
			$(formPick).find('input[name="original"]').each(function(index,item){
				var attType = item.title;
				if (o[item.name]) {    
		           if (!o[item.name].push) {    
		               o[item.name] = [o[item.name]];    
		           }    
		           o[item.name].push(item.value + "?" + attType || '');    
		       } else {    
		           o[item.name] = item.value + "?" + attType || '';    
		       } 
			})
//		    var	a=$(formPick).serializeArray();
//		    $.each(a, function() {
//		       if(this.name=='original'){
//		    	   var attType = this.title;
//		    	   if (o[this.name]) {    
//			           if (!o[this.name].push) {    
//			               o[this.name] = [o[this.name]];    
//			           }    
//			           o[this.name].push(this.value + "?" + attType || '');    
//			       } else {    
//			           o[this.name] = this.value + "?" + attType || '';    
//			       }    
//		       }
//		       
//		    });    
		    return o;  
		},
		//把form自动封装成ticketVO所需json格式
		ticketVO:function(formPick){
			var o = {};  
		    var	a=$(formPick).serializeArray();
		    $.each(a, function() {
		      /* if(this.name=='title'||this.name=='project'){
		    	   o[this.name]=this.value;
		       }else{*/
		    	   if(!o.fields){
		    		   o.fields={};
		    	   }
		    	   if (o.fields[this.name]) {
			           if (!o.fields[this.name].push) {
			        	   o.fields[this.name] = [o.fields[this.name]];
			           }    
			           o.fields[this.name].push(this.value || '');
			       } else {
			    	   o.fields[this.name] = this.value || '';
			       }    
		      // }
		    });
		    o.map = true;
		    return o;  
		},
		/**
		 * 调用android方法
		 * @param code
		 * @param dataJson
		 * @param callBack
		 */
		callNative:function(code,dataJson,callBack){
			var data = {actionCode:code, data:dataJson};
		    window.WebViewJavascriptBridge.send(
		        data,callBack
		    );
		},
		toast:function(tip){
		    var data = {actionCode:14, data:{tip: tip}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        }
		    );
		},
		dialog:function(title,message,confirm,cancel){
			 var data = {actionCode:14, data:{title: title,message:message}};
			    window.WebViewJavascriptBridge.send(
			        data,function(responseData) {
			        	var obj=eval('(' + responseData + ')');
			        	if(obj.status==1){
			        		if(confirm!=null){
			        			confirm();
			        		}
			            }else{
			            	if(cancel!=null){
			            		cancel();
			            	}
			            }
			        }
			    );
		},
		datePicker:function(picker,hiden){
			var data = {actionCode: 4};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //responseData {status:1, message: "success!", data: {time: "yyyy-MM-dd HH:mm:ss"}
		            var obj=eval('(' + responseData + ')');
		            if(obj.status==1){
		            	$(picker).val($.trim(obj.data.time).substring(0,16));
		            	$(hiden).val(obj.data.time);
		            }else{
		            	toast(obj.message);
		            }
		        }
		    );
		},

		search:function(searcher,type){
			var keyword=$(searcher).val();
			var data = {actionCode: 16,data:{type:type,keyword:keyword}};
			window.WebViewJavascriptBridge.send(
			   data,function(responseData) {
			        //responseData responseData ={status:1,message:"success!",data:{id:21,name:'搜索回显值'}}
			         //alert(responseData);
			         var obj=eval('(' + responseData + ')');
			         if(obj.status==1){
			        	$(searcher).val(obj.data.name); 
			        	$(searcher).after("<input type='hidden' value='"+obj.data.id+"' name='id' >");
			        	$(searcher).attr("idValue",obj.data.id);
			         }else{
			             toast(obj.message);
			         }
			      }
			   );
		},
		voice:function(containerPicker,type){
			var data = {actionCode: 5};
			window.WebViewJavascriptBridge.send(
			   data,function(responseData) {
			        //responseData {status:1, message: "success!", data: {path: "/meida/0/a.mgr"}
			         //alert(responseData);
			         var obj=eval('(' + responseData + ')');
			         if(obj.status==1){
			        	 var time=obj.data.duration;
			        	 var second=time%60;
			        	 var minute=Math.floor(time/60);
			        	 time=minute==0?'':(minute+"'")+second+'"';
			        	 var location=obj.data.path;
			             var div='<div class="voice-over">'
				            	 +'<div class="bar left" onclick=msAndroid.voicePlay("'+location+'",this) >'
				            	 +	'<span class="svg_icon">'
				            	 +		'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100%" height="100%" viewBox="15.167 -16.333 1000.636 1000.678" enable-background="new 15.167 -16.333 1000.636 1000.678" xml:space="preserve" fill="#6abf4a"><path class="s_svg_path" num="3" d="M279.314,359.008l-139.09,124.998l139.09,125.027c0,0,53.483-62.528,53.483-125.027C332.797,421.449,279.314,359.008,279.314,359.008 M450.5,202.674l-74.899,72.915c0,0,85.578,62.586,85.578,208.417c0,145.86-85.578,208.417-85.578,208.417l74.899,72.944c0,0,117.674-135.502,117.674-281.361C568.174,338.175,450.5,202.674,450.5,202.674 M782.135,484.006c0-239.666-181.894-437.667-181.894-437.667l-74.87,72.915c0,0,149.799,145.889,149.799,364.751S525.37,848.728,525.37,848.728l74.87,72.944C600.241,921.672,782.135,723.701,782.135,484.006"/></svg>'
				            	 +  '</span><span class="right">'+time+'</span>'
				            	 +'</div>'
				            	 +'<p class="left" onclick="removeVoice(this)"><span class="icon-delete"></span></p>'
				            	 +'<input name="original" type="hidden" value="'+location+'" title="6"/>'
				            	 +'</div>';
			             if(type == 'multi'){
			            	 $(containerPicker).append(div);
			             }
			             if(type == 'single'){
			            	 $(containerPicker).children('.voice-over').remove();
			            	 $(containerPicker).append(div);
			             }
			         }else{
			             toast(obj.message);
			         }
			      }
			   );
		},
		voicePlay:function(location,el){
			var data = {actionCode: 10, data:{path: location}};
			//设置播放样式
			voicePlayStart(el);
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        	//播放结束样式
		        	voicePlayOver(el);
		        }
		    );
		},
		/**
		 * picker 图片容器
		 * attType 附件类型回传服务端  0-电子签名 ,1-其他,2-到场凭证,3-工单凭证,4-换上件,5-换下件
		 * callback
		 * isDir true显示拍照和图库 false只显示拍照
		 * isSignature  是否电子签名
		 */
		file:function(picker,attType,callBack){
			var data = {
						actionCode: 2,
						data:{}
						};//{actionCode: 0,data:{isDir:false}}
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        //responseData {status:1, message: "success!", data: {path: "/media/0/a.jpg"}
		            var obj=eval('(' + responseData + ')');
			        if(obj.status==1){
			        	if(picker){
			        		var location=obj.data.path;
			        		var li="<li style='width:15%;float: left;'><img onclick=msAndroid.pictureOpen(this,'"+location+"') src='android_asset://file.png'>" +
			        				"<input name='original' type='hidden' value='"+location+"' title='"+attType+"'/></li>";
			        		if(location != "" && location != null){
								$(picker).append(li);
							}
			        	}
			        	if(callBack){
			        		callBack(responseData);
			        	}
			        }else{
			             toast(obj.message+"文件上传失败。");
			        }
		        }
		    );
		},
		/**
		 * picker 图片容器
		 * attType 附件类型回传服务端  0-电子签名 ,1-其他,2-到场凭证,3-工单凭证,4-换上件,5-换下件
		 * callback
		 * isDir true显示拍照和图库 false只显示拍照
		 * isSignature  是否电子签名
		 */
		picture:function(picker,attType,callBack,isDir,isSignature){
			var data = {
						actionCode: 0,
						data:{
								isDir : isDir==null?true:isDir,
								isSignature : isSignature==null?false:isSignature
							 }
						};//{actionCode: 0,data:{isDir:false}}
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        //responseData {status:1, message: "success!", data: {path: "/media/0/a.jpg"}
		            //alert(responseData);
		            var obj=eval('(' + responseData + ')');
			        if(obj.status==1){
			        	if(picker){
			        		var location=obj.data.path;
			        		var li="<li style='width:15%;float: left;' ><img  onclick=msAndroid.pictureOpen(this,'"+location+"') src='"+location+"'>" +
			        				"<input name='original' type='hidden' value='"+location+"' title='"+attType+"'/></li>"; 
			        		$(picker).append(li);
			        	}
			        	if(callBack){
			        		callBack(responseData);
			        	}
			        }else{
			             toast(obj.message);
			        }
		        }
		    );
		},
		pictureOpen:function(img,path){
			var data = {actionCode: 1,data:{path:path}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        	var obj=eval('(' + responseData + ')');
			        if(obj.status==1){
			        	//删除页面上的图片
			        	if(obj.data.deleted){
			        		$(img).parent("li").remove();
			        	}
			       }
		        }
		    );
		},
		pictureOpena:function(img,path){
			var data = {actionCode: 1,data:{path:path}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        	var obj=eval('(' + responseData + ')');
		        }
		    );
		},
		menu:function(menuData,callback,defaultSelected){
			// data:{items:[{text:t1,value:v1},{text:t2,value:v2}], selected: 0, type: "menu"|"option"}
			var data = {actionCode: 6, data: {items: menuData, type: 'menu',selected:defaultSelected}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            callback(responseData);
		        }
		    );
		},
		location:function(lPicker,latPicker,longPicker){
			var data={actionCode:19};
			window.WebViewJavascriptBridge.send(
			        data,function(responseData) {
			            var obj=eval('('+responseData+')');
			            if(obj.status==1){
			            	$(lPicker).val(obj.data.location);
			            	$(latPicker).val(obj.data.latitude);
			            	$(longPicker).val(obj.data.longitude);
			            }else if(obj.status == -1){
                            data={actionCode:20};
                            window.WebViewJavascriptBridge.send(
                                data,function(responseData) {
                                    obj=eval('('+responseData+')');
                                    if(obj.status==1){
                                        $(lPicker).val(obj.data.location);
                                        $(latPicker).val(obj.data.latitude);
                                        $(longPicker).val(obj.data.longitude);
                                    }else{
                                        toast(obj.message);
                                    }
                                });
			            }else{
			            	toast(obj.message);
			            }
			        }
			 );
		},
		scanCode:function(picker,callback){
			var data = {actionCode: 3};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        	//responseData {status:1, message: "success!", data: {code: "alkfjdwoiwoir323i4o"}
		            // alert(responseData)
		        	var jsonObj=eval("("+responseData+")");
		        	if(jsonObj.status==1){
		        		if(picker){
		        			$(picker).val(jsonObj.data.code);
		        		}
		        		if(callback){
		        			callback(jsonObj);
		        		}
		        	}else{
		        		toast(jsonObj.message);
		        	}
		        }
		    );
		},
		navigation:function(longitude, latitude){
			//alert(longitude + ":" + latitude);
		    var data = {actionCode:15, data:{longitude:longitude, latitude:latitude}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //alert(responseData)
		        }
			);
		},
		//url为全路径
		get:function(url,retrieve){
			var data = {actionCode:12, data:{url:url,retrieve:retrieve==null?false:true}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //alert(responseData)
		        }
		    );
		},
		//url为全路径
		refresh:function(url){
			var data = {actionCode:18, data:{url:url}};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //alert(responseData)
		        }
		    );
		},
		call:function(phone,event){
			var e=event || window.event;
	        if (e && e.stopPropagation){
	            e.stopPropagation();    
	        }else{
	            e.cancelBubble=true;
	        }
	        var reg=/^[\+0-9-]{3,18}$/;
	        if(phone.match(reg)==null){
	        	toast("电话格式有误");
	        	return;
	        }
			var data = {actionCode:9, data:{phone:phone}};
			window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //alert(responseData)
		        }
		    );
		},
		//url为相对路径
		//back -1  上一级, 0  刷新, active 活动工单, receive 接单列表, grab 抢单列表 ,history 历史工单列表
		upload:function(url,jsonParam,method,back,message){
			//var data = {actionCode: 7, data:{url:"api.com/v1/controller",method:"post"/"put"/"delete", var1:"kkll", var2:"klsj"}};
			jsonParam.url=url;
			jsonParam.method=method;
		    var data = {actionCode: 7, data: jsonParam};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        //responseData {status:1, message: "success!", data: {}}
		            var jsonObj=eval("("+responseData+")");
		            if(jsonObj.status==1){
		            	msAndroid.toast(message);
		            	if(back != null){
		            		msAndroid.get("android:"+back);
		            	}
		            }else{
		            	toast(jsonObj.message);
		            	toast(jsonObj.message+"附件无法上传");
		            }
		        }
		    );
		},
		//url为相对路径
		//back -1  上一级, 0  刷新, active 活动工单, receive 接单列表, grab 抢单列表 ,history 历史工单列表
		post:function(url,jsonParam,method,back,callback){
			//var data = {actionCode: 7, data:{url:"api.com/v1/controller",method:"post"/"put"/"delete", var1:"kkll", var2:"klsj"}};
			jsonParam.url=url;
			jsonParam.method=method;
		    var data = {actionCode: 7, data: jsonParam};
		    window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		        //responseData {status:1, message: "success!", data: {}}
		            var jsonObj=eval("("+responseData+")");
		            if(jsonObj.status==1){
		            	if(back != null){
		            		msAndroid.get("android:"+back);
		            	}
//		            	else{
//		            		msAndroid.get("android:0");
//		            	}
		            }else{
			            if(callback) {callback(jsonObj)};
		            	toast(jsonObj.message)
		            }
		        }
		    );
		},
		//url为相对路径
		//back -1  上一级, 0  刷新, active 活动工单, receive 接单列表, grab 抢单列表 ,history 历史工单列表
		postCreateTicket:function(url,jsonParam,method,backUrl,callback){
			//var data = {actionCode: 7, data:{url:"api.com/v1/controller",method:"post"/"put"/"delete", var1:"kkll", var2:"klsj"}};
			jsonParam.url=url;
			jsonParam.method=method;
			var data = {actionCode: 7, data: jsonParam};
			window.WebViewJavascriptBridge.send(
				data,function(responseData) {
				//responseData {status:1, message: "success!", data: {}}
					var jsonObj=eval("("+responseData+")");
					if(jsonObj.status==1){
						if(backUrl != null){
							var ticketid = jsonObj.data;
							var newBackUrl = backUrl.replace("{ticketid}",ticketid);
							msAndroid.get(newBackUrl);
						}
					}else{
						if(callback) {callback(jsonObj)};
						toast(jsonObj.message)
					}
				}
			);
		},
		//url为相对路径
		post_receive:function(url,jsonParam,method,receive){
			//var data = {actionCode: 7, data:{url:"api.com/v1/controller",method:"post"/"put"/"delete", var1:"kkll", var2:"klsj"}};
			jsonParam.url=url;
			jsonParam.method=method;
			var data = {actionCode: 7, data: jsonParam};
			window.WebViewJavascriptBridge.send(
					data,function(responseData) {
						//responseData {status:1, message: "success!", data: {}}
						var jsonObj=eval("("+responseData+")");
						if(jsonObj.status==1){
							if(receive){
								msAndroid.get("android:receive");
							}else{
								msAndroid.get("android:0");
							}
						}else{
							toast(jsonObj.message)
						}
					}
			);
		},
		/**
		 * 回调上一个页面的js方法
		 * method方法名，jsonObj参数
		 */
		transferData:function(method,jsonObj){
			var data = {actionCode:21, data:jsonObj,message:method};
			window.WebViewJavascriptBridge.send(
		        data,function(responseData) {
		            //alert(responseData)
		        }
		    );
		}
	}
}();


/**
 * 签到
 */
function signIn(){
	if(msAndroid.pageData.actionForm==''){
		msAndroid.callNative(13,msAndroid.pageData,function(response){
            //alert(response);
            var obj=eval('(' + response + ')');
            if(obj.status == 0 || obj.status == -1){
                if(obj.status == -1) {
                    //距离太远!
                    msAndroid.toast(obj.message);
                }
                //手动签到
            	toast(obj.message);
                msAndroid.pageData.type = "menu";
                msAndroid.pageData.selected = 1;
                //msAndroid.pageData.items = [{text:"拍照签到",index:0}, {text:"扫码签到",index:1}];
                msAndroid.pageData.items = [{text:"GPS探测到您不在此工单范围内, 请拍照到场",index:0}, {text:"拍照签到",index:1}];
                msAndroid.callNative(6, msAndroid.pageData,function(response){
                    var obj=eval('(' + response + ')');
                    //alert(response);
                    if(obj.status == 1){
                        var idx = obj.data.index;
                        if(idx == 1){
                        	msAndroid.picture(null,null, function(responseData){
                        		//alert(responseData);
                        		var obj=eval('(' + responseData + ')');
                        		//msAndroid.pageData.page_file=obj.data.path+"?0";
                        		//alert(obj.data.path);
                        		next(null,msAndroid.pageData.ticketId,"SIGNIN");
                        		createAttachment(msAndroid.pageData.ticketId,obj.data.path);
                        	},false);
                        }else if(idx == 2){
                        	msAndroid.scanCode(function(){
                        		next(null,msAndroid.pageData.ticketId,"SIGNIN");
                        	});
                        }
                    }
                });
            //}else if(obj.status == -1){
				//距离太远!
			//	msAndroid.toast(obj.message);
            }else{
				msAndroid.get("android:active")
			}
        });
	}
}
/**
 * 下一步
 */
function next(url,ticketId,action){
	if(url==null){
		url='/tickets/'+ticketId+'/'+action;
	}
	msAndroid.post(url,{action:action,ticketId:ticketId},'put','active');
}
/**
 * 签到创建附件
 * @param ticketId
 * @param filePath
 */
function createAttachment(ticketId,filePath){
	var url="/tickets/"+ticketId+"/attachments/info";
	msAndroid.post(url,{original:[filePath + "?2"]},'post');
}
/**
 * 页面跳转
 * @param url
 * android 提供url的host，服务端提供contextPath
 */
function toActivityByUrl(url,retrieve){
	//alert(url);
	var data = {actionCode:12, data:{url:url,retrieve:retrieve==null?false:true}};
    window.WebViewJavascriptBridge.send(
        data,function(responseData) {
        }
    );
}


/**
 * 事前提醒 
 */
function timeremind(textPicker,valuePicker){
	if(msAndroid[textPicker]==null||msAndroid[textPicker]<0){
		msAndroid[textPicker]=-1
	}
	var menu=[{text:"提前30分钟提醒",value:30,index:0},
	          {text:"提前1小时提醒",value:60,index:1},
	          {text:"提前2小时提醒",value:120,index:2},
	          {text:"提前4小时提醒",value:240,index:3},
	          {text:"不设置提醒",value:0,index:4}];
	msAndroid.menu(menu,function(response){
		var obj=eval('('+response+')');
		if(obj.status==1){
			$(textPicker).val(obj.data.text);
			if(valuePicker!=null){
				$(valuePicker).val(obj.data.text);
			}
			msAndroid[textPicker]=obj.data.index;
		}else{
			toast(obj.message);
		}
	},msAndroid[textPicker]);
}

/**
 * 项目名称 
 */
function ticketProject(textPicker,valuePicker,projectText){
	if(msAndroid[textPicker]==null||msAndroid[textPicker]<0){
		msAndroid[textPicker]=0
	}
	var menu = eval('(' + projectText + ')');
	//var menu = eval('(' + projectText.replace(/\&quot;/g,'"') + ')');
	msAndroid.menu(menu,function(response){
		var obj=eval('('+response+')');
		if(obj.status==1){
			$(textPicker).val(obj.data.text);
			if(valuePicker!=null){
				$(valuePicker).val(obj.data.value);
			}
			msAndroid[textPicker]=obj.data.index;
		}else{
			toast(obj.message);
		}
	},msAndroid[textPicker]);
}

/**
 *关单原因
 */
function breakoffreason(textPicker,valuePicker){
	if(msAndroid[textPicker]==null||msAndroid[textPicker]<0){
		msAndroid[textPicker]=0
	}
	var menu=[{text:"客户自行解决",value:"客户自行解决",index:0},
	          {text:"工程师远程解决",value:"工程师远程解决",index:1},
	          {text:"不在服务范围",value:"工程师远程解决",index:2}];
	msAndroid.menu(menu,function(response){
		var obj=eval('('+response+')');
		if(obj.status==1){
			$(textPicker).val(obj.data.text);
			if(valuePicker!=null){
				$(valuePicker).val(obj.data.text);
			}
			msAndroid[textPicker]=obj.data.index;
		}else{
			toast(obj.message);
		}
	},msAndroid[textPicker]);
}
/**
 * 设置播放语音样式
 */
function voicePlayStart(obj){
	if($(obj).data("Interval")!=undefined){
		clearInterval($(obj).data("Interval"));
	}
	var ts = setInterval(function (obj) {
		var num=obj.find(".s_svg_path").attr("num");
		if(num=="3"){
			obj.find(".s_svg_path").attr("d","M279.314,359.008l-139.09,124.998l139.09,125.027c0,0,53.483-62.528,53.483-125.027C332.797,421.449,279.314,359.008,279.314,359.008");
			obj.find(".s_svg_path").attr("num","1");	 
		}else if(num=="1"){
			obj.find(".s_svg_path").attr("d","M279.314,359.008l-139.09,124.998l139.09,125.027c0,0,53.483-62.528,53.483-125.027C332.797,421.449,279.314,359.008,279.314,359.008 M450.5,202.674l-74.899,72.915c0,0,85.578,62.586,85.578,208.417c0,145.86-85.578,208.417-85.578,208.417l74.899,72.944c0,0,117.674-135.502,117.674-281.361C568.174,338.175,450.5,202.674,450.5,202.674");
			obj.find(".s_svg_path").attr("num","2");
		}else if(num=="2"){
			obj.find(".s_svg_path").attr("d","M279.314,359.008l-139.09,124.998l139.09,125.027c0,0,53.483-62.528,53.483-125.027C332.797,421.449,279.314,359.008,279.314,359.008 M450.5,202.674l-74.899,72.915c0,0,85.578,62.586,85.578,208.417c0,145.86-85.578,208.417-85.578,208.417l74.899,72.944c0,0,117.674-135.502,117.674-281.361C568.174,338.175,450.5,202.674,450.5,202.674 M782.135,484.006c0-239.666-181.894-437.667-181.894-437.667l-74.87,72.915c0,0,149.799,145.889,149.799,364.751S525.37,848.728,525.37,848.728l74.87,72.944C600.241,921.672,782.135,723.701,782.135,484.006");
			obj.find(".s_svg_path").attr("num","3");
		}
	}, 500,$(obj));
	$(obj).data("Interval",ts);
}
/**
 * 语音播放结束样式
 * @param obj
 */
function voicePlayOver(obj){
  clearInterval($(obj).data("Interval"));
  $(obj).find(".s_svg_path").attr("d","M279.314,359.008l-139.09,124.998l139.09,125.027c0,0,53.483-62.528,53.483-125.027C332.797,421.449,279.314,359.008,279.314,359.008 M450.5,202.674l-74.899,72.915c0,0,85.578,62.586,85.578,208.417c0,145.86-85.578,208.417-85.578,208.417l74.899,72.944c0,0,117.674-135.502,117.674-281.361C568.174,338.175,450.5,202.674,450.5,202.674 M782.135,484.006c0-239.666-181.894-437.667-181.894-437.667l-74.87,72.915c0,0,149.799,145.889,149.799,364.751S525.37,848.728,525.37,848.728l74.87,72.944C600.241,921.672,782.135,723.701,782.135,484.006");
  $(obj).find(".s_svg_path").attr("num","3");
}
